org.eclipse.vtp.framework.interactions.voice.vxml
Class Dialog

java.lang.Object
  extended by org.eclipse.vtp.framework.interactions.core.support.Widget
      extended by org.eclipse.vtp.framework.interactions.voice.vxml.Dialog
All Implemented Interfaces:
VXMLConstants
Direct Known Subclasses:
Form, Menu

public abstract class Dialog
extends Widget
implements VXMLConstants

The Dialog class is the base class for the family of VXML elements that collect data from the caller, allow the caller to select from a set of menu options, or manipulate the flow of the call during processing.

Certain VXML compliant platforms allow the use of proprietary properties to be applied to the dialogs of a VXML document. These properties are written to the VXML document in the order they are added to the Dialog instance.

During processing of a dialog's constituent elements, events and error can be generated. EventHandlers can be added to the dialog instance that will handle events and errors not dealt with by the child's event handlers. The handlers will be written to the VXML document in the order they were added.

Version:
2.0
Author:
Trip Gilman, Lonnie Pryor

Field Summary
 
Fields inherited from interface org.eclipse.vtp.framework.interactions.voice.vxml.VXMLConstants
EMPTY, FILE_EXT_GSL, FILLED_MODE_ALL, FILLED_MODE_ANY, GRAMMAR_MODE_DTMF, GRAMMAR_MODE_VOICE, METHOD_GET, METHOD_POST, MIME_TYPE_GSL, MIME_TYPE_SRGS, NAME_APPLICATION, NAME_ASSIGN, NAME_AUDIO, NAME_BARGEIN, NAME_BEEP, NAME_BLOCK, NAME_BRIDGE, NAME_CATCH, NAME_CHOICE, NAME_COMPLETETIMEOUT, NAME_COND, NAME_CONFIDENCELEVEL, NAME_COUNT, NAME_DEST, NAME_DISCONNECT, NAME_DTMF, NAME_DTMFTERM, NAME_ELSE, NAME_ELSEIF, NAME_ENCTYPE, NAME_ENUMERATE, NAME_ERROR, NAME_EVENT, NAME_EVENTEXPR, NAME_EXIT, NAME_EXPR, NAME_FIELD, NAME_FILLED, NAME_FINALSILENCE, NAME_FORM, NAME_GOTO, NAME_GRAMMAR, NAME_ID, NAME_IF, NAME_INCOMPLETETIMEOUT, NAME_INPUTMODES, NAME_INTERDIGITTIMEOUT, NAME_ITEM, NAME_MAXNBEST, NAME_MAXSPEECHTIMEOUT, NAME_MAXTIME, NAME_MENU, NAME_METHOD, NAME_MODE, NAME_NAME, NAME_NAMELIST, NAME_NEXT, NAME_NOINPUT, NAME_NOMATCH, NAME_ONE_OF, NAME_OPTION, NAME_PARAM, NAME_PROMPT, NAME_PROPERTY, NAME_RECORD, NAME_REPEAT, NAME_REPROMPT, NAME_RETURN, NAME_ROOT, NAME_RULE, NAME_SCOPE, NAME_SCRIPT, NAME_SENSITIVITY, NAME_SPEEDVSACCURACY, NAME_SRC, NAME_SUBDIALOG, NAME_SUBMIT, NAME_TERMCHAR, NAME_TERMTIMEOUT, NAME_THROW, NAME_TIMEOUT, NAME_TRANSFER, NAME_TYPE, NAME_VALUE, NAME_VAR, NAME_VERSION, NAME_VXML, NAMESPACE_URI_VXML, QNAME_XML_LANG, SCOPE_DIALOG, SCOPE_DOCUMENT, TYPE_CDATA, VERSION_2_0
 
Constructor Summary
protected Dialog(java.lang.String id)
          Creates a new instance of Dialog with the specified id and a grammar scope of Dialog.SCOPE_DIALOG.
protected Dialog(java.lang.String id, java.lang.String scope)
          Creates a new instance of Dialog with the specified id and the grammar scope of scope.
 
Method Summary
 void addEventHandler(EventHandler eventHandler)
          Adds an EventHandler to this dialog instance.
 void clearProperty(java.lang.String propertyName)
          Clears the value of a property in this dialog.
 java.lang.String getID()
          Returns the identifier for this dialog instance.
 java.lang.String[] getPropertyNames()
          Returns the names of the properties of this dialog.
 java.lang.String getPropertyValue(java.lang.String propertyName)
          Returns the value of the specified property or null if no such property exists.
 java.lang.String getScope()
          Returns the grammar scope of this dialog's grammars.
 void removeEventHandler(EventHandler eventHandler)
          Removes an event handler from this dialog instance.
 void setID(java.lang.String id)
          Sets the identifier of this dialog instance.
 void setProperty(java.lang.String propertyName, java.lang.String propertyValue)
          Sets the value of a property in this dialog.
 void setScope(java.lang.String scope)
          Sets the grammar scope of this dialog instance.
protected  void writeAttributes(org.xml.sax.helpers.AttributesImpl attributes)
          Write the attribute members of this dialog to the supplied set.
protected  void writeEventHandlers(org.xml.sax.ContentHandler outputHandler)
          Write the event handlers of this dialog to the specified content handler.
protected  void writeProperties(org.xml.sax.ContentHandler outputHandler)
          Writes the properties of this dialog to the specified content handler.
 
Methods inherited from class org.eclipse.vtp.framework.interactions.core.support.Widget
toString, writeAttribute, writeChildren, writeChildren, writeWidget, writeWidget, writeWidget
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Dialog

protected Dialog(java.lang.String id)
          throws java.lang.IllegalArgumentException,
                 java.lang.NullPointerException
Creates a new instance of Dialog with the specified id and a grammar scope of Dialog.SCOPE_DIALOG. Throws an IllegalArgumentException if id argument is null or is an empty string.

Parameters:
id - The identifier of this dialog instance.
Throws:
java.lang.IllegalArgumentException - If the supplied ID is empty.
java.lang.NullPointerException - If the supplied ID is null.

Dialog

protected Dialog(java.lang.String id,
                 java.lang.String scope)
          throws java.lang.IllegalArgumentException,
                 java.lang.NullPointerException
Creates a new instance of Dialog with the specified id and the grammar scope of scope. Throws an IllegalArgumentException if id argument is null or is an empty string. Throws IllegalArgumentException if scope argument is not Dialog.SCOPE_DIALOG or Dialog.SCOPE_DOCUMENT.

Parameters:
id - The identifier of this dialog instance
scope - The scope of any grammars defined within the dialog.
Throws:
java.lang.IllegalArgumentException - If the supplied ID is empty.
java.lang.IllegalArgumentException - If the supplied scope is invalid.
java.lang.NullPointerException - If the supplied ID is null.
java.lang.NullPointerException - If the supplied scope is null.
Method Detail

getID

public java.lang.String getID()
Returns the identifier for this dialog instance.

Returns:
The identifier for this dialog instance.

getScope

public java.lang.String getScope()
Returns the grammar scope of this dialog's grammars.

Returns:
The dialog's grammar scope.

getPropertyNames

public java.lang.String[] getPropertyNames()
Returns the names of the properties of this dialog.

Returns:
The names of the properties of this dialog.

getPropertyValue

public java.lang.String getPropertyValue(java.lang.String propertyName)
                                  throws java.lang.NullPointerException
Returns the value of the specified property or null if no such property exists.

Parameters:
propertyName - The name of the property to find the value of.
Returns:
The value of the specified property or null if no such property exists.
Throws:
java.lang.NullPointerException - If the supplied property name is null.

setID

public void setID(java.lang.String id)
           throws java.lang.IllegalArgumentException,
                  java.lang.NullPointerException
Sets the identifier of this dialog instance.

Parameters:
id - The new identifier of this dialog instance
Throws:
java.lang.IllegalArgumentException - If the supplied ID is empty.
java.lang.NullPointerException - If the supplied ID is null.

setScope

public void setScope(java.lang.String scope)
              throws java.lang.IllegalArgumentException,
                     java.lang.NullPointerException
Sets the grammar scope of this dialog instance. Throws IllegalArgumentException if scope is not Dialog.SCOPE_DIALOG or Dialog.SCOPE_DIALOG.

Parameters:
scope - The new grammar scope for this dialog instance.
Throws:
java.lang.IllegalArgumentException - If the supplied scope is invalid.
java.lang.NullPointerException - If the supplied scope is null.

setProperty

public void setProperty(java.lang.String propertyName,
                        java.lang.String propertyValue)
                 throws java.lang.NullPointerException
Sets the value of a property in this dialog.

Parameters:
propertyName - The name of the property to set.
propertyValue - The value to set the property to.
Throws:
java.lang.NullPointerException - If the supplied property name or value is null.

clearProperty

public void clearProperty(java.lang.String propertyName)
                   throws java.lang.NullPointerException
Clears the value of a property in this dialog.

Parameters:
propertyName - The name of the property to clear.
Throws:
java.lang.NullPointerException - If the supplied property name is null.

addEventHandler

public void addEventHandler(EventHandler eventHandler)
                     throws java.lang.NullPointerException
Adds an EventHandler to this dialog instance. The event handlers will be written to the VXML document in the order they are added.

Parameters:
eventHandler - The event handler to add to this dialog.
Throws:
java.lang.NullPointerException - If the supplied event handler is null.

removeEventHandler

public void removeEventHandler(EventHandler eventHandler)
                        throws java.lang.NullPointerException
Removes an event handler from this dialog instance.

Parameters:
eventHandler - The event handler to remove from this dialog.
Throws:
java.lang.NullPointerException - If the supplied event handler is null.

writeAttributes

protected void writeAttributes(org.xml.sax.helpers.AttributesImpl attributes)
Write the attribute members of this dialog to the supplied set.

Parameters:
attributes - The attribute set to write to.
Throws:
java.lang.NullPointerException - If the supplied attribute set is null.

writeProperties

protected void writeProperties(org.xml.sax.ContentHandler outputHandler)
                        throws java.lang.NullPointerException,
                               org.xml.sax.SAXException
Writes the properties of this dialog to the specified content handler.

Parameters:
outputHandler - The handler to write the properties to.
Throws:
org.xml.sax.SAXException - If the writing of the properties fails.
java.lang.NullPointerException - If the supplied content handler is null.

writeEventHandlers

protected void writeEventHandlers(org.xml.sax.ContentHandler outputHandler)
                           throws java.lang.NullPointerException,
                                  org.xml.sax.SAXException
Write the event handlers of this dialog to the specified content handler.

Parameters:
outputHandler - The content handler to write to.
Throws:
java.lang.NullPointerException - If the supplied content handler is null.
org.xml.sax.SAXException - If the writing of one of the event handlers fails.